x86/debug: Plumb pending_dbg through the monitor and devicemodel interfaces
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 31 May 2018 17:50:50 +0000 (18:50 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 27 Dec 2019 16:37:42 +0000 (16:37 +0000)
commit21867648033df025129eca9bbcfdbd0310d13562
tree3915649b71fe4044bbebc118cbed33405473b3ba
parentd79cc6bc2bac1cfba239e5b3e28a851fb22901dc
x86/debug: Plumb pending_dbg through the monitor and devicemodel interfaces

Like %cr2 for pagefaults, %dr6 contains ancillary information for debug
exceptions, and needs similar handling.

For xendevicemodel_inject_event(), no ABI change is needed (although an API
one would be ideal).  Switch from 'cr2' to 'extra' in variable names which
don't constitute an API change, and update the documentation to match.

For the monitor interface, vm_event_debug needs extending with a pending_dbg
field.  This shall behave like the VT-x PENDING_DBG control.  Extend
hvm_monitor_debug() and for now, always pass in 0 - this will be fixed
eventually, when other hypervisor bugfixes are complete.

While modifying hvm_monitor_debug(), take the opportunity to correct trap type
and instruction length from unsigned long to unsigned int, as they are both
tiny values.

Finally, adjust xen-access.c to the new expectations.  Introspection tools
intercepting debug exceptions should mirror the new pending_dbg field into
xendevicemodel_inject_event() for %dr6 to be processed correctly for the
guest.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Petre Pircalabu <ppircalabu@bitdefender.com>
tools/libs/devicemodel/core.c
tools/libs/devicemodel/include/xendevicemodel.h
tools/tests/xen-access/xen-access.c
xen/arch/x86/hvm/monitor.c
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/vmx/vmx.c
xen/include/asm-x86/hvm/monitor.h
xen/include/public/hvm/dm_op.h
xen/include/public/vm_event.h